/*oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO*/
/*
Authors: Ram Ovadia 201374022 and Lior Fass 300069705
Project: HW Assignment 4 
Description: This is the header of the module implementing the client functionality of Oiway.  
*/
/*oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO*/

#ifndef CLIENT_H
#define CLIENT_H

#include <stdlib.h>
#include <stdio.h>
#include <winsock2.h>
#include <tchar.h>
#include "common_utils.h"
#include "SocketSendRecvTools.h"
#include "Djikstra.h"
#include "map.h"

#define GPS_PORT	52000 
#define SERVER_PORT 51000
#define LINE_LEN	1024

/*
 * struct to hold attributes of client.
 * nodes src, dest for navigation. 
 * server_addr for ip address of Oiway server and GPS. 
 * sockets s_gps, s_server for server and gps neworking.
 * log_file - file pointer to log file. 
 * map - struct used for navigation.
 * route - array to hold nodes indexes in shortest path commuted. 
 */
typedef struct client_attr_t
{
	Node src;
	Node dest;
	char *server_addr;
	SOCKET s_gps;
	SOCKET s_server;
	FILE *log_file;
	Map *map;
	int *route;
} Client_attr;

/*
 * Client's main. 
 *
 * Input:
 * -----
 * server_address - pointer to string holding valid ip address of Oiway server and gps.  
 * xi, yi / xj, yj - coordinates of initial / final node.
 * client_log_file_name - pointer to string holding name of log file to be created by the client.  
 *
 * Output:
 * -----
 * 0 - successful.
 * 1 - failed. 
 */
int client_main(char *server_address, int xi, int yi, int xj, int yj, char *client_log_file_name);



#endif // CLIENT_H